import api from "../request/request"
// 添加个人信息
export const addUserInfo = (obj) => {
  const data = api({
    url: 'filing/v1/api/personInfo/self',
    method: 'POST',
    data: obj
  })
  return data
}
// 添加健康管理
export const addHealthManageApi = (obj) => {
  const data = api({
    url: 'filing/v1/api/healthManage',
    method: 'POST',
    data: obj
  })
  return data
}
// 获取健康管理
export const getHealthManageApi = (obj) => {
  const data = api({
    url: `filing/v1/api/healthManage?familyId=${obj.familyId}`,
    method: 'GET'
  })
  return data
}
// 删除健康管理
export const deleteHealthManage = (obj) => {
  const data = api({
    url: `filing/v1/api/healthManage?id=${obj.id}`,
    method: 'DELETE'
  })
  return data
}
// 更新健康管理
export const updateHealthManage = (obj) => {
  const data = api({
    url: `filing/v1/api/healthManage`,
    method: 'PUT',
    data: obj
  })
  return data
}
// 更新建档状态
export const updateFamilyArchiveStatus = (obj) => {
  const data = api({
    url: 'filing/v1/api/familyArchiveStatus',
    method: 'PATCH',
    data: obj
  })
  return data
}

// 获取字典
export const getDictionary = () => {
  const data = api({
    url: 'filing/v1/api/dataDictionary/familyMemberRelationship',
    method: 'GET'
  })
  return data
}

// 添加家庭成员
export const addFamilyMember = (obj) => {
  const data = api({
    url: 'filing/v1/api/familyMember',
    method: 'POST',
    data: obj
  })
  return data
}
// 获取家庭成员信息
export const getFamilyMemberApi = (obj) => {
  const data = api({
    url: `filing/v1/api/familyMember?familyId=${obj.familyId}&familyMemberId=${obj.familyMemberId}`,
    method: 'GET',
  })
  return data
}

// 修改家庭成员信息
export const modifyFamilyMemberApi = (obj) => {
  const data = api({
    url: `filing/v1/api/familyMember`,
    method: 'PATCH',
    data: obj
  })
  return data
}

// 获取用户个人信息
export const getPersonInfoApi = (obj) => {
  const data = api({
    url: `filing/v1/api/personInfo?userId=${obj.userId}`,
    method: 'GET',
  })
  return data
}
// 修改个人信息
export const upDataPersonApi = (obj) => {
  const data = api({
    url: 'filing/v1/api/personInfo',
    method: 'PATCH',
    data: obj
  })
  return data
}
// 删除家庭成员信息
export const deleteFamilyMember = (obj) => {
  const data = api({
    url: `filing/v1/api/familyMember?familyMemberId=${obj.familyMemberId}`,
    method: 'DELETE',
  })
  return data
}

// 绑定家庭成员信息
export const bindingFamilyMember = (obj) => {
  const data = api({
    url: `filing/v1/api/healthManage/bind`,
    method: 'PATCH',
    data: obj
  })
  return data
}

// 发送模板消息
export const sendMsg = (obj) => {
  const data = api({
    url: `api/OfficialAccounts?requestId=${obj.requestId}&familyMemberId=${obj.familyMemberId}`,
    method: 'GET',
  })
  return data
}

// 邀请建档
export const inviteRecordApi = (obj) => {
  const data = api({
    url: 'filing/v1/api/personinfo/invite',
    method: 'POST',
    data: obj
  })
  return data
}

// 修改默认家庭
export const updateDefaultFamily = (obj) => {
  const data = api({
    url: 'filing/v1/api/family/updateDefaultFamily',
    method: 'PUT',
    data: obj
  })
  return data
}

// 创建家庭
export const createFamily = (obj) => {
  const data = api({
    url: 'filing/v1/api/family/createFamily',
    method: 'POST',
    data: obj
  })
  return data
}

// 修改家庭名称
export const updateFamilyName = (obj) => {
  const data = api({
    url: 'filing/v1/api/family/updateFamilyName',
    method: 'PATCH',
    data: obj
  })
  return data
}

// 查询家庭名称
export const searchFamilyName = (obj) => {
  const data = api({
    url: `filing/v1/api/family?familyId=${obj.familyId}`,
    method: 'GET'
  })
  return data
}